package homework.api.day07._cp;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class WriterDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("osw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos,StandardCharsets.UTF_8);
        osw.write("零落成泥碾作尘,只有香如故。");
        osw.close();

        FileInputStream fis = new FileInputStream("osw.txt");
        InputStreamReader isr = new InputStreamReader(fis,StandardCharsets.UTF_8);
        int d;
        while((d=isr.read())!=-1){
            System.out.print((char)d);
        }
        isr.close();

    }
}
